package Test;

import java.util.*;

public class Demo7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int len = str.length();
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < len; i++) {
            for (int j = i + 2; j <=len; j++) {
                if (new StringBuilder(str.substring(i, j)).reverse().toString().equals(str.substring(i, j))) {
                    list.add(str.substring(i, j));
                }
            }
        }
        Collections.sort(list, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.length()-o2.length();
            }
        });
        String[] a = list.toArray(new String[list.size()]);

        for (String s : a) {
            System.out.println(s);
        }
    }
}
